package com.wlz.learnjuc.sync;

/**
 *  锁消除
 * @author wlz
 * @date 2022-04-11  10:27 下午
 */
public class LockClearTest {

    public static void main(String[] args) {
        LockClearTest lockClearTest = new LockClearTest();
        for (int i = 0; i < 100000; i++) {
            lockClearTest.append("aa", "bb");
        }
    }

    public void append(String str1, String str2) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(str1).append(str2);
    }

    //锁的消除
    private void method1(){
        Object object1 = new Object();
        synchronized (object1){
            //
            //sdf
            //asdf
            System.out.println();
        }

    }
}
